package com.highspeed.bdk.gateway.socket.analyze.message.preset_deploy.resolver;

import com.highspeed.bdk.gateway.Util;
import com.highspeed.bdk.gateway.socket.analyze.message.preset_deploy.base.MessageResolver;

import java.util.Map;

public class AppPortSTResolver extends MessageResolver {

    @Override
    protected Map doResolveBody(byte[] response) {
        String appName = Util.subBytesToString(response, getOffset(), 32);
        logger.info("信号名称：应用组件名称......" + appName);
        offsetN(32);

        int rioPhyAddr = Util.getUnsignedShort(response, getOffset());
        logger.info("信号名称：RIO物理地址......" + rioPhyAddr);
        offset2();

        int portID = Util.getUnsignedShort(response, getOffset());
        logger.info("信号名称：端口ID......" + portID);
        offset2();

        String portName = Util.subBytesToString(response, getOffset(), 32);
        logger.info("信号名称：端口名称......" + portName);
        offsetN(32);
        return getContainer();
    }
}
